package com.mingke.java.GroupChatPro;

import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.CompletionHandler;

/**
 * @author mingke
 * @function 群聊系统Pro向客户端写入数据的回调
 * @date 2021/11/10
 */
public class GroupWriteHandler implements CompletionHandler<Integer, Void> {

    @Override
    public void completed(Integer flag, Void attachment) {
        if(flag == -1) {
            System.out.println("出了一点问题");
        }
    }

    @Override
    public void failed(Throwable exc, Void attachment) {
        try {
            exc.printStackTrace();
        }finally {
            System.out.println("写入数据遇到了一点问题");
        }
    }
}
